package com.thread.future;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.thread.model.entity.UserDemo;
import com.thread.model.service.IUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.Future;

/**
 * @author ccubee
 * @since 21-3-30 22:32
 */
@Service
@RequiredArgsConstructor
public class FutureService {

    private final IUserService userService;


    public void future() {
        // 查询数据库
        IPage<UserDemo> page = new Page<>(1, 10000);
        IPage<UserDemo> pageOne = userService.page(page);
//        IPage<UserDemo> pageTwo = userService.lambdaQuery().page(page);
        List<UserDemo> records = pageOne.getRecords();
        // future操作
        List<List<UserDemo>> lists = Lists.partition(records, 1000);
        for (List<UserDemo> list : lists) {

        }

    }
    

}
